home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-01-05 | 2.9 KB | 151 lines | [TEXT/PJMM] |
- UNIT INIT;
-
- INTERFACE
-
- USES
- GLOBALS;
-
- PROCEDURE Init_Mac (exit_proc: ProcPtr);
-
- PROCEDURE MakeMenus;
-
- PROCEDURE MakeWindow;
-
- IMPLEMENTATION
-
- PROCEDURE Init_Mac;
- BEGIN
- MaxApplZone;
- MoreMasters;
- MoreMasters;
- MoreMasters;
- MoreMasters;
- InitGraf(@thePort);
- InitFonts;
- FlushEvents(everyEvent, 0);
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(exit_proc);
- InitCursor;
-
- cTime := 0;
- crTime := 0;
- pTime := 0;
-
- perfIndex := TO_P_FUNCTION;
-
- cPerf := 0.0;
- crPerf := 0.0;
- pPerf := 0.0;
- END;
-
- PROCEDURE MakeMenus;
- VAR
- iStr: Str255;
- mValue: Longint;
- spacePos: Integer;
- BEGIN
- appleMenu := GetMenu(APPLEID);
- AddResMenu(appleMenu, 'DRVR');
- InsertMenu(appleMenu, 0);
-
- fileMenu := GetMenu(FILEID);
- InsertMenu(fileMenu, 0);
-
- DisableItem(fileMenu, 4);
- DisableItem(fileMenu, 7);
- DisableItem(fileMenu, 10);
-
-
- DisableItem(fileMenu, NEWITEM);
- DisableItem(fileMenu, OPENITEM);
- DisableItem(fileMenu, CLOSEITEM);
- DisableItem(fileMenu, SAVEITEM);
- DisableItem(fileMenu, SAVEASITEM);
- DisableItem(fileMenu, PAGESETUPITEM);
- DisableItem(fileMenu, PRINTITEM);
-
- editMenu := GetMenu(EDITID);
- InsertMenu(editMenu, 0);
-
- DisableItem(editMenu, 7);
-
- compareMenu := GetMenu(COMPAREID);
- InsertMenu(CompareMenu, 0);
- DisableItem(compareMenu, 3);
-
- pointerMenu := GetMenu(POINTERID);
- InsertMenu(pointerMenu, -1);
-
- loopMenu := GetMenu(LOOPID);
- InsertMenu(loopMenu, -1);
-
- CheckItem(loopMenu, 1, TRUE);
- GetItem(loopMenu, 1, iStr);
- StringToNum(iStr, mValue);
- numLoops := Integer(mValue);
-
- CheckItem(pointerMenu, 1, TRUE);
- GetItem(pointerMenu, 1, iStr);
- spacePos := pos(' ', iStr);
- delete(iStr, spacePos, length(iStr) - spacePos + 1);
-
- StringToNum(iStr, mValue);
- pSize := mValue;
-
- SetItemCmd(compareMenu, 1, CHAR(hMenuCmd));
- SetItemMark(compareMenu, 1, CHAR(POINTERID));
-
- SetItemCmd(compareMenu, 2, CHAR(hMenuCmd));
- SetItemMark(compareMenu, 2, CHAR(LOOPID));
-
- DrawMenuBar;
- END;
-
- PROCEDURE MakeWindow;
- VAR
- r: Rect;
- tRect: Rect;
- cRect: Rect;
- index: Integer;
- wTitle: Str255;
- BEGIN
- SetRect(r, 40, 60, 480, 60 + 120);
- wTitle := 'Pascal • C Comparison';
-
- theWindow := NewWindow(NIL, r, wTitle, FALSE, 4, WindowPtr(-1), TRUE, 0);
-
- SetPort(theWindow);
- TextFont(3);
- TextSize(9);
- TextMode(srcCopy);
-
- cRect := theWindow^.portRect;
- WITH cRect DO
- BEGIN
- right := right - 4;
- top := top + 4;
- left := right - 80;
- bottom := top + 20;
- END;
-
- do_it := NewControl(theWindow, cRect, 'Do It!', TRUE, 0, 0, 1, 0, 0);
-
- SetRect(ptrSizeDst, 110, 8, 162, 22);
- SetRect(loopSizeDst, 200, 8, 232, 22);
-
- SetRect(cTimeDst, 160, 56, 242, 70);
- SetRect(crTimeDst, 160, 74, 242, 88);
- SetRect(pTimeDst, 160, 92, 242, 106);
-
- SetRect(cPerfDst, 280, 54, 410, 70);
- SetRect(crPerfDst, 280, 74, 410, 88);
- SetRect(pPerfDst, 280, 92, 410, 106);
-
- CenterWindow(theWindow, screenBits.bounds);
- ShowWindow(theWindow);
-
- END;
-
- END.